package edu.aynu.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * (Problem)实体类
 *
 * @author sitong
 * @since 2021-06-21 20:24:21
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "problem", shards = 3, replicas = 1)
public class Problem implements Serializable {
    private static final long serialVersionUID = -62888581208472973L;

    @Id
    private Integer id;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String title;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String answer;

    @Field(type = FieldType.Keyword)
    private String subject;

    @Field(type = FieldType.Keyword)
    private String type;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String expound;

    // ---- 以下是用户附加的属性 ----
    @JsonUnwrapped
    @JsonIgnore
    private Answer myAnswer;

}
